<template>
	<scroll-view class="uni-node" :show-scrollbar="false" scroll-x>
		<template v-for="item in answerItem">
			<view class="view"  :class="[questionCompleted(item.completed),currentItemOrder == item.itemOrder?'currentActive':'']" @click="goAnchor(item.itemOrder)">{{item.itemOrder + 1}}</view>
		</template>
	</scroll-view>		
</template>

<script>
	import { mapState, mapGetters } from 'vuex'
	export default {
		props:{
			//题目节点
			answerItem:{
				type: Array,
				default: function () {
				    return []
				}
			},
			currentItemOrder:{
				type: Number,
				default: 0
			}
		},
		data(){
			return {
				leftNum: 10
			}
		},
		methods: {
			questionCompleted(completed){
				return completed ? 'active' : '';
			},
			goAnchor(selector){
				// this.$el.querySelector(selector)
				// .scrollIntoView()
				console.log(selector);
				this.$emit("goArc",selector);
				
			}
		},
		computed: {
			...mapGetters('enumItem', ['enumFormat']),
			...mapState('enumItem', {
			  doCompletedTag: state => state.exam.question.answer.doCompletedTag
			})
		}
	}
</script>

<style lang="scss">
.uni-node{
	white-space: nowrap;
	margin-top: 30rpx;
	width: 92%;
	.active {
		background: #FCEFDB;
	}
	.currentActive{
		background: #66BB6A;
		color: #fff;
	}
	.view{
		display: inline-block;
		width: 80rpx;
		height: 80rpx;
		text-align: center;
		line-height: 80rpx;
		border-radius: 20rpx;
		border:2rpx solid var(--themeColor);
		margin-right: 20rpx;
		
	}
}
</style>
